<?xml version="1.0" encoding="ISO-8859-1" ?>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@include file="../../context.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Quarter Share Data</title>
<%@include file="../common_Admin_imports.jsp"%>
<%@include file="../common_list_page.jsp"%>

<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$(".datepicker")
								.datepicker(
										{
											changeMonth : true,
											changeYear : true,
											showButtonPanel : true,
											dateFormat : 'yy',
											onClose : function(dateText, inst) {
												var month = $(
														"#ui-datepicker-div .ui-datepicker-month :selected")
														.val();
												var year = $(
														"#ui-datepicker-div .ui-datepicker-year :selected")
														.val();
												$(this)
														.datepicker(
																'setDate',
																new Date(year,
																		month,
																		1));
											}
										});

						$("#qCode").change(function() {
							$("#toDatepicker").val("-1");
						});

						resetSelectAll();
						$('#selectAll').on('click', function() {
							selectAll();
						});

						paginationNextBtn("${pageContext.request.contextPath}/admin/quarterlysharedata/list.html?totalRecords=${quarterlyShareDataPage.totalNoOfRecords}&page=");

					});

	function deleteFiltered() {
		var proceed = confirm("Are you sure, you want to delete the searched dataset ? If you select yes, the operation cannot be undone");
		if (proceed) {
			var baseUrl = "${pageContext.request.contextPath}/admin/quarterlysharedata/deleteFiltered.html";
			document.location = baseUrl;
		}

		return proceed;
	}
</script>

<style type="text/css">
.datepicker,.searchSelector {
	margin-right: 10px;
	width: 100px;
}

.searchSelector {
	margin-right: 10px;
	width: 150px;
}

.btnSerch {
	padding: 4px;
}
</style>
</head>
<body>
	<div class="main_wrapper">
		<div class="header_wrapper">
			<div class="container-fluid">
				<div class="header_inner_wrapper clearfix">
					<div class="row-fluid">
						<div class="header_left span4">List of Quarter Data</div>
						<div class="header_right span8">
							<div class="input-append" style="float: right;">
								<!-- search section -->
								<form:form method="POST" commandName="criteria" id="form_id"
									action="${pageContext.request.contextPath}/admin/quarterlysharedata/search.html">
									<form:input cssClass="datepicker" path="fromYear"
										id="fromDatepicker" />
									<form:input cssClass="datepicker" path="toYear"
										id="toDatepicker" />
									<form:select cssClass="searchSelector" id="qCode"
										path="quarterCode">
										<form:option value="">--ANY--</form:option>
										<form:option value="Q1">Quarter 1</form:option>
										<form:option value="Q2">Quarter 2</form:option>
										<form:option value="Q3">Quarter 3</form:option>
										<form:option value="Q4">Quarter 4</form:option>
									</form:select>
									<form:input onselect="" cssClass="searchSelector"
										list="companyNameList" path="companyName" />
									<input class="btnSerch btn-info" value="Search" type="submit" />
									<input id="reset_btn" class="btnSerch btn-info" type="button"
										value="Reset" />
								</form:form>
								<datalist id="companyNameList"> <c:forEach
									items="${companyMap}" var="company">
									<option value="${company.name }" />
								</c:forEach> </datalist>
								<jsp:include page="../common_link.jsp" />

								<!-- end of search section -->
							</div>
						</div>
					</div>
				</div>
				<div class="row-fluid">
					<div class="main_table">
						<form:form method="POST"
							action="${pageContext.request.contextPath}/admin/quarterlysharedata/delete/selected.html">
							<table class="table table-bordered table-striped">
								<thead>
									<tr>
										<th id="tableHeader"><input type="checkbox"
											id="selectAll" name="deleteHeader" /></th>
										<th id="tableHeader">No</th>
										<th id="tableHeader">Year</th>
										<th id="tableHeader">Quarter</th>
										<th id="tableHeader">Company</th>
										<th id="tableHeader">Weighted Average</th>
										<th id="tableHeader">Average Equity</th>
										<th id="tableHeader">Average Total Asse</th>
										<th id="tableHeader">Revenues</th>
										<th id="tableHeader">EBITDA</th>
										<th id="tableHeader">Cash</th>
										<th id="tableHeader">Share Free Float</th>
										<th></th>
										<th></th>
									</tr>
								</thead>
								<tbody>
									<c:forEach var="quarterlyShareData"
										items="${quarterlyShareDataPage.pageData}">
										<tr>
											<td><input type="checkbox" class="selectedId"
												name="deleteIds" value="${quarterlyShareData.id}" /></td>
											<td>${quarterlyShareData.id}</td>
											<td id="tableHeader">${quarterlyShareData.year}</td>
											<td id="tableHeader">${quarterlyShareData.quarterCode}</td>
											<td>${quarterlyShareData.company.name}</td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.weightedAverage}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.averageEquity}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.averageTotalAsse}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.revenues}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.ebitda}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.cash}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${quarterlyShareData.sharesInFreefloat}" /></td>

											<td><div class="btn btn-info">
													<a
														href="${pageContext.request.contextPath}/admin/quarterlysharedata/edit/${quarterlyShareData.id}.html">Edit</a>
												</div></td>
											<td><div class="btn btn-danger">
													<a
														lang="${pageContext.request.contextPath}/admin/quarterlysharedata/delete/${quarterlyShareData.id}.html"
														href="javascript:void(0);"
														onclick="return confirmAndDelete(this);">Delete</a>
												</div></td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
							<div>
								<div>
									<input
										onclick="return confirm('Are you sure, you want to delete all the selected results. This opperation cannot be undone');"
										class="btn btn-danger" type="submit" value="Delete Selected" />
									<input onclick="return deleteFiltered();"
										class="btn btn-danger" type="button"
										value="Delete Filtered List" />
								</div>
							</div>
						</form:form>
						<!-- paging section -->
						<div class="pagination pagination-right">
							<!-- page number -->
							Page&nbsp;<input value="${quarterlyShareDataPage.currentPageNo}"
								style="width: 50px;" type="number" min="0"
								max="${quarterlyShareDataPage.totalNoOfPages }" id="pageNum">
								<!-- end page number -->
								<ul>
									<li><c:if test="${quarterlyShareDataPage.showPrev}">
											<a
												href="${pageContext.request.contextPath}/admin/quarterlysharedata/list.html?page=${quarterlyShareDataPage.currentPageNo-1}&totalRecords=${quarterlyShareDataPage.totalNoOfRecords}">Prev</a>
										</c:if></li>
									<c:forEach begin="${quarterlyShareDataPage.startPageNo}"
										var="page" end="${quarterlyShareDataPage.endPageNo}">
										<li><a
											<c:if test="${quarterlyShareDataPage.currentPageNo==page}">style="background-color:#79BAEC"</c:if>
											href="${pageContext.request.contextPath}/admin/quarterlysharedata/list.html?page=${page}&totalRecords=${quarterlyShareDataPage.totalNoOfRecords}">${page}</a></li>&nbsp;
							</c:forEach>
									<li><c:if test="${quarterlyShareDataPage.showNext}">
											<a
												href="${pageContext.request.contextPath}/admin/quarterlysharedata/list.html?page=${quarterlyShareDataPage.currentPageNo+1}&totalRecords=${quarterlyShareDataPage.totalNoOfRecords}">Next</a>
										</c:if></li>
									<li><a class="pageCountLink">${quarterlyShareDataPage.totalNoOfPages }
											Pages</a></li>
								</ul>
						</div>
						<div>
							<br></br>
						</div>
						<!-- paging section -->
						<div class="btn btn-success">
							<a
								href="${pageContext.request.contextPath}/admin/quarterlysharedata/add.html">New</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>